# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=whoosh
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=2.7.4
pkgrel=1
pkgdesc="Fast, pure-Python full text indexing, search, and spell checking library (mingw-w64)"
url='https://bitbucket.org/mchaput/whoosh/wiki/Home'
license=('BSD')
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools"
             'mercurial')
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest-runner")
_dtoken="53/72/6c6f1e787d9cab2cc733cf042f125abec07209a58308831c9f292504e826"
source=("hg+https://bitbucket.org/mchaput/${_realname}#tag=${pkgver}")
sha256sums=('SKIP')

prepare() {
  cd ${srcdir}
  cp -r ${_realname} build-python-${CARCH}
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/build-python-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd ${srcdir}/build-python-${CARCH}
  ${MINGW_PREFIX}/bin/python setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --skip-build

  install -D -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}"/share/licenses/python-${_realname}/LICENSE.txt
}
